#include "mrc_base.h"
#include "i18n.h"
#include "res_str.h"
#include "..\..\..\..\frame\ASAppFw.h"

int32 MRC_EXT_INIT(void)
{
    as_app_fw_init();
    return MR_SUCCESS;
}

int32 MRC_EXT_EXIT(void)
{
    as_app_fw_deinit();
    return MR_SUCCESS;
}

int32 mrc_appEvent(int32 code, int32 param0, int32 param1)
{
    if(code == MR_KEY_PRESS)
    {
        as_app_fw_key_hdlr(AS_EVT_KEY_DOWN, param0);
    }
    else if(code == MR_KEY_RELEASE)
    {
        as_app_fw_key_hdlr(AS_EVT_KEY_UP, param0);
    }
    else if(code == MR_MOUSE_DOWN)
    {
        as_app_fw_touch_hdlr(AS_EVT_TOUCH_DOWN, param0, param1);
    }
    else if(code == MR_MOUSE_MOVE)
    {
        as_app_fw_touch_hdlr(AS_EVT_TOUCH_MOVE, param0, param1);
    }
    else if(code == MR_MOUSE_UP)
    {
        as_app_fw_touch_hdlr(AS_EVT_TOUCH_UP, param0, param1);
    }
    else if(code == MR_DIALOG_EVENT)
    {
        if(param0 == MR_DIALOG_KEY_OK)
        {
            as_destroy_input_screen(ASTRUE);
        }
        else if(param0 == MR_DIALOG_KEY_CANCEL)
        {
            as_destroy_input_screen(ASFALSE);
        }

        as_app_resume();
    }

    return MR_SUCCESS;
}

int32 mrc_appPause()
{
    as_app_fw_pause();
    return MR_SUCCESS;
}

int32 mrc_appResume()
{
    as_app_fw_resume();
    return MR_SUCCESS;
}
